package edu.hrbu.trade01.config;

import edu.hrbu.trade01.interceptor.LoginIntercepter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 徐登宇
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginIntercepter())
                .excludePathPatterns(
                        "/home/**",
                        "/analysis/**", // TODO 一会删掉
                        "/web/css/**",
                        "/web/js/**",
                        "/web/buyer/**",
                        "/buyer/**",
                        "/commence/**",
                        "/web/login.html",
                        "/web/register.html",
                        "/web/ui/css/**",
                        "/web/ui/js/**",
                        "/web/ui/images/**",
                        "/web/ui/lib/**"
                );
    }
}
